<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>两数之和</title>
	</head>
	<body>
		<p id="demo"></p>
		<script>
			var nums = [2,7,11,15];
			var target = 9;
			for(var i=0;i<nums.length-1;i++){
				for(var j=i+1;j<nums.length;j++){
					console.log('i',nums[i]);
					console.log('j',nums[j]);
					if(nums[i]+nums[j]==9){
						console.log(i);
			            console.log(j);
			            document.getElementById('demo').innerHTML=i+':'+j;
					}
				}
			}
			
		</script>
	</body>
</html>
